#ifndef STS_HPP
#define STS_HPP

#include "modes.hpp"
#include "pch.hpp"

struct SelectInfo {
    Vi_Mode mode{Vi_Mode::V_M_Insert};
    long count{0};
    long begin_col{0};
    long begin_row{0};
    long origin_col{0};
    long origin_row{0};
};

struct UrlData {
    UrlData(char *u, long c, long r) : url(u, g_free), col(c), row(r) {}

    std::unique_ptr<char, decltype(&g_free)> url; // g_free from gtk ?
    long col, row;
};

struct SearchPanelInfo {
    GtkWidget *da{gtk_drawing_area_new()};
    Overlay_Mode mode{Overlay_Mode::O_M_Hidden};
    std::vector<UrlData> url_list{};
    char *fulltext{nullptr};

    ~SearchPanelInfo() {
        g_clear_object(&entry);
        g_clear_object(&da);
    }

    GtkWidget *entry{gtk_entry_new()};
};

struct HintInfo {
    PangoFontDescription *font{nullptr};
    cairo_pattern_t *fg{nullptr};
    cairo_pattern_t *bg{nullptr};
    cairo_pattern_t *af{nullptr};
    cairo_pattern_t *ab{nullptr};
    cairo_pattern_t *border{nullptr};
    double padding{0.0};
    double border_width{0.0};
    double roundness{0.0};
};

struct ConfigInfo {
    char *config_file;
    char *browser{nullptr};
    HintInfo hints{};
    gboolean dynamic_title{FALSE};
    gboolean urgent_on_bell{FALSE};
    gboolean clickable_url{FALSE};
    gboolean clickable_url_ctrl{FALSE};
    gboolean size_hints{FALSE};
    gboolean filter_unmatched_urls{TRUE};
    gboolean modify_other_keys{FALSE};
    gboolean fullscreen{FALSE};
    gboolean smart_copy{FALSE};
    gboolean dpi_aware{FALSE};
    gboolean copy_mouse_selection{FALSE};
    int tag{-1};
    gdouble font_scale{0.0};
    int font_size{0};
};

struct KeybindInfo {
    GtkWindow *window;
    VteTerminal *vte;
    SearchPanelInfo panel;
    SelectInfo select;
    ConfigInfo config;
    std::function<void(GtkWindow *)> fullscreen_toggle{gtk_window_fullscreen};
};

struct DrawCallbackInfo {
    VteTerminal *vte;
    SearchPanelInfo *panel;
    HintInfo *hints;
    gboolean filter_unmatched_urls;
};

#endif // header file protect
